﻿#region

using System.Collections.Generic;
using BTL.OnlineTestingSocial.Domain.TestingEngine;
using BTL.Technology.Data;

#endregion

namespace BTL.OnlineTestingSocial.Services.TestingEngine.Service.DAL
{
    public class CategoryRepository : ICategoryRepository
    {
        private readonly IDataHelper _dataHelper;
        private readonly DbSetting _dbSettings;

        public CategoryRepository(DbSetting dbSettings, IDataHelper dataHelper)
        {
            _dbSettings = dbSettings;
            _dataHelper = dataHelper;
        }

        #region ICategoryRepository Members

        public IEnumerable<Category> GetCategories()
        {
            return _dataHelper.FillCollection<Category>(
                _dbSettings.ConnectionString,
                _dbSettings.GetCategoriesSp);
        }

        #endregion
    }
}